﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WLMCoreLibrary;
using MiWebSite_Core;


namespace MWS_Store.XML
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            WebSiteMainConfiguration config = WebSiteMainConfiguration.GetConfig();
            dbConnector ConexionDB = new dbConnector(config.Connections["WebSite"].value);
            Random random = new Random();
            int cantidadElementos = 30;
            if (Request.QueryString["cantidadElementos"] != null)
                cantidadElementos = Convert.ToInt32(Request.QueryString["cantidadElementos"]);
            StoreProductoCollection listaProductos = new StoreProductoCollection(random,cantidadElementos,ref ConexionDB);
            ConexionDB.CloseConnection();
            Response.ContentType = "text/xml";
            Response.Write( WLMFunctions.SerializeObject(listaProductos, true));

        }
    }
}